package com.bdqn.controller;

import com.bdqn.dto.ApiResult;
import com.bdqn.mapper.GetHomeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin
public class GetHomeController {
    @Autowired
    GetHomeMapper getHomeMapper;

    @RequestMapping("/home/salesSumMoney")
   public ApiResult salesSumMoney(){
       return new ApiResult(200,"查询成功",getHomeMapper.salesSumMoney());
   }

    @RequestMapping("/home/monthGrossmargin")
    public ApiResult monthGrossmargin(){
        return new ApiResult(200,"查询成功",getHomeMapper.monthGrossmargin());
    }
    @RequestMapping("/home/monthSumPrice")
    public ApiResult monthSumPrice(){
        return new ApiResult(200,"查询成功",getHomeMapper.monthSumPrice());
    }


    @RequestMapping("/home/customerInfo")
    public ApiResult customerInfo(){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("todaysCustom",getHomeMapper.todaysCustom());
        resultMap.put("weekCustom",getHomeMapper.weekCustom());
        resultMap.put("monthCustom",getHomeMapper.monthCustom());
        resultMap.put("sumCust",getHomeMapper.sumCust());
        return new ApiResult(200,"查询成功",resultMap);
    }

    @RequestMapping("/home/SupplierInfo")
    public ApiResult SupplierInfo(){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("todaysSupplier",getHomeMapper.todaysSupplier());
        resultMap.put("weekSupplier",getHomeMapper.weekSupplier());
        resultMap.put("monthSupplier",getHomeMapper.monthSupplier());
        resultMap.put("sumSupplier",getHomeMapper.sumSupplier());
        return new ApiResult(200,"查询成功",resultMap);
    }

    @RequestMapping("/home/GoodsInfo")
    public ApiResult GoodsInfo(){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("todaysGoods",getHomeMapper.todaysGoods());
        resultMap.put("todaysGoodsPrice",getHomeMapper.todaysGoodsPrice());
        resultMap.put("monthGoods",getHomeMapper.monthGoods());
        resultMap.put("goodsNum",getHomeMapper.goodsNum());
        resultMap.put("goodsSumPrice",getHomeMapper.goodsSumPrice());

        return new ApiResult(200,"查询成功",resultMap);
    }
    @RequestMapping("/home/SaleInfo")
    public ApiResult SaleInfo(){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("todaysSalegoods",getHomeMapper.todaysSalegoods());
        resultMap.put("monthSalegoods",getHomeMapper.monthSalegoods());
        resultMap.put("todaysgoodsmoney",getHomeMapper.todaysgoodsmoney());
        resultMap.put("todaysSalegoodsNum",getHomeMapper.todaysSalegoodsNum());
        resultMap.put("todaysSalegoodsPrice",getHomeMapper.todaysSalegoodsPrice());
        resultMap.put("monthSalegoodsNum",getHomeMapper.monthSalegoodsNum());
        resultMap.put("monthSalegoodsPrice",getHomeMapper.monthSalegoodsPrice());
        resultMap.put("todaysSaleShipping",getHomeMapper.todaysSaleShipping());
        return new ApiResult(200,"查询成功",resultMap);
    }

    @RequestMapping("/home/GrossprofitInfo")
    public ApiResult GrossprofitInfo(){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("todaysGrossprofit",getHomeMapper.todaysGrossprofit());
        resultMap.put("todaysProfit",getHomeMapper.todaysProfit());
        resultMap.put("monthProfit",getHomeMapper.monthProfit());
        return new ApiResult(200,"查询成功",resultMap);
    }






}
